import React, { Component } from 'react';
import './footer.css'
import { connect } from 'react-redux'
import { actionCreator,mapStateToProps,mapDispatchToProps } from '../../store/actions'
class Footer extends Component {
  
  deleteDone = (ev) => {
    let { todoList } = this.props
    let newList = todoList.filter(el => {
      return el.done===true
    })
    let res = newList.map(el => {
      return el.id
    })
    this.props.deleteDone(actionCreator('deleteDone',res))
  }
  render() {
    return (
      <div className='footer'>
        <a href='#' onClick={this.deleteDone}>删除完成任务</a>
      </div>
    );
  }
}

export default connect(mapStateToProps,mapDispatchToProps)(Footer);